home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************\
-
- File: Left-right split.c
-
- Purpose: Graphic effect to fade main window to solid pattern.
- See comments below for more description.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program in a file named "GNU General Public License".
- If not, write to the Free Software Foundation, 675 Mass Ave,
- Cambridge, MA 02139, USA.
-
- \**********************************************************************/
-
- #include "timing.h"
-
- #define CorrectTime 2
- #define theWindowHeight (boundsRect.bottom-boundsRect.top)
- #define theWindowWidth (boundsRect.right-boundsRect.left)
-
- pascal short main(Rect boundsRect, Pattern *thePattern);
-
- pascal short main(Rect boundsRect, Pattern *thePattern)
- {
- RgnHandle topRgn, bottomRgn;
- RgnHandle topDestRgn, bottomDestRgn;
- Rect topRect, bottomRect;
- short iter;
- short offset;
-
- offset=5;
-
- topRgn=NewRgn();
- OpenRgn();
- MoveTo(0, 0);
- LineTo(0, theWindowHeight);
- LineTo(theWindowWidth, 0);
- LineTo(0, 0);
- CloseRgn(topRgn);
- OffsetRgn(topRgn, boundsRect.left, boundsRect.top);
-
- bottomRgn=NewRgn();
- OpenRgn();
- MoveTo(theWindowWidth, theWindowHeight);
- LineTo(theWindowWidth, 0);
- LineTo(0, theWindowHeight);
- LineTo(theWindowWidth, theWindowHeight);
- CloseRgn(bottomRgn);
- OffsetRgn(bottomRgn, boundsRect.left, boundsRect.top);
-
- topRect=bottomRect=boundsRect;
- topRect.right=topRect.left+offset;
- bottomRect.left=bottomRect.right-offset;
- topDestRgn=NewRgn();
- bottomDestRgn=NewRgn();
-
- for (iter=0; iter<theWindowWidth; iter+=offset)
- {
- StartTiming();
-
- RectRgn(topDestRgn, &topRect);
- RectRgn(bottomDestRgn, &bottomRect);
- SectRgn(topRgn, topDestRgn, topDestRgn);
- SectRgn(bottomRgn, bottomDestRgn, bottomDestRgn);
- FillRgn(topDestRgn, *thePattern);
- FillRgn(bottomDestRgn, *thePattern);
-
- topRect.left+=offset;
- topRect.right+=offset;
- bottomRect.left-=offset;
- bottomRect.right-=offset;
-
- TimeCorrection(CorrectTime);
- }
-
- DisposeRgn(topRgn);
- DisposeRgn(bottomRgn);
- DisposeRgn(topDestRgn);
- DisposeRgn(bottomDestRgn);
-
- return 0;
- }
-